//
//  RightViewController.m
//  RONGAO
//
//  Created by wei wang on 2017/3/27.
//  Copyright © 2017年 wei wang. All rights reserved.
//

#import "RightViewController.h"
//
@interface RightViewController ()<UIWebViewDelegate>
@property (weak, nonatomic) IBOutlet UIWebView *webView;

@end

@implementation RightViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self setNavigationTitle:@"商城" titleColor:nil];
    
    [self setLeftButtonImage:[UIImage imageNamed:@"icon_back_nor"]];
    
    _webView.delegate=self;
    
    [_webView setUserInteractionEnabled:YES];//是否支持交互
    [_webView setOpaque:NO];//opaque是不透明的意思
    [_webView setScalesPageToFit:YES];//自动缩放以适应屏幕
    [SVProgressHUD showWithStatus:@"正在努力加载中..."];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [SVProgressHUD dismiss];
    });
    

    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.rg988.com"]]];
}

- (void)onLeftButtonClick:(id)sender{
    
    
    if ([self.webView canGoBack] == YES) {
        [self.webView goBack];
    }else{
        [self.navigationController popViewControllerAnimated:YES];
    }
    
}
-(void)webViewDidStartLoad:(UIWebView *)webView{
    NSLog(@"加载开始");
    
    
}



-(void)webViewDidFinishLoad:(UIWebView *)webView{
    if (self.tabBarController.selectedIndex == 1) {
        
    }else{
        return;
    }
    NSLog(@"加载结束");
    
    [SVProgressHUD dismiss];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
